<?php
set_time_limit(45);
if($_POST){
	require_once("dompdf_config.inc.php");

	define("DOMPDF_ENABLE_REMOTE", true); 
	
	$html = '
	<html>
	<head>
	<style type="text/css"> 
	body{ 
		margin-top: 0pt;
		margin-left: 0pt;
		margin-right: 0pt;
		margin-bottom: 0pt;
		padding-left:184px;
		background-image: url(background_proposta.jpg);
		height:1224px;
	}
	.paddingTotal{
		padding-top:1.2cm;
		padding-left:1.2cm;
		padding-bottom:1.2cm;
		padding-right:1cm;
	}
	</style>
	</head>
	<body><div class="paddingTotal">
	'.$_POST['text'].'</div>
	</body>
	</html>
	';
	
	//die($html);

	$dompdf = new DOMPDF();
	$dompdf->set_paper("a4");
	$dompdf->load_html($html);
	$dompdf->render();
	$dompdf->stream("sample.pdf");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>HTML2PDF</title>
<link rel="stylesheet" href="jwysiwyg/jwysiwyg/jquery.wysiwyg.css" type="text/css" />
<link rel="stylesheet" href="examples.css" type="text/css" />
<script type="text/javascript" src="jwysiwyg/jquery/jquery-1.3.2.js"></script>
<script type="text/javascript" src="jwysiwyg/jwysiwyg/jquery.wysiwyg.js"></script>
<script type="text/javascript">
$(function()
{
$('#text').wysiwyg();
});
</script>
<style type="text/css">
input, textarea {
	font-family: lucida console;
	font-size: 9pt;
	border: 1px solid #B0B0B0;
}
body {
	font-family: lucida console;
	font-size: 9pt;
	background-color: #F0F0F0;
}
</style>
</head>
<body>
<h1>DOMPDF e JWYSIWYG</h1>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" target="_blank">
Content:<br>
<textarea name="text" id="text" cols="80" rows="15"></textarea><br><br>
<input type="submit" value="Generate PDF">
</form>
</body>
</html>

